System and method for built in test for optical sensors

ABSTRACT

An optical system including one or more optical sensors and a processing unit capable of performing built-in tests of the optical sensor(s) and methods thereof are disclosed. The processing unit includes a built-in test module configured to detect a reduction of an optical quality of at least some of the images generated by at least one of the optical sensors with respect to an expected optical quality thereof. The built-in test module may be configured to determine whether the reduction of the optical quality thereof is due to the “external optical disturbances” (EOD) and/or failure of the optical sensor(s)/system. The processing unit may include a relative built-in test module configured to compare at least some images generated by at least two of the optical sensor(s) and to determine which of the at least two optical sensors thereof, if any, is subjected to at least one of the EOD and/or failure.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a National Phase Application of PCT InternationalApplication No. PCT/IL2019/050224, International Filing Date Feb. 27,2019, entitled System and Method for Built In Test for Optical Sensors,published on Sep. 6, 2019 as WO 2019/167044 claiming the benefit of U.S.Provisional Patent Application No. 62/636,210, filed Feb. 28, 2018,which is hereby incorporated by reference.

FIELD OF THE INVENTION

The present invention relates to the field of optical sensors, and moreparticularly, to systems and methods for built in test for opticalsensors.

BACKGROUND OF THE INVENTION

Optical sensors, such as still or video cameras, when used for providingvisual information which is required with a given resolution and/or agiven signal-to-noise (S/N) figure may be very sensitive to opticaldisturbances such as dirt or moisture accumulating on the externaloptical element (e.g., outmost lens), low visibility due to moist ordusty air, low lighting conditions and the like, collectively nominated‘external optical disturbances’ (EOD). There is a need for systems usingsuch optical sensors to be able to verify whether frames acquired usingthese sensors have low optical quality due to EOD or due to failure(either optical, electronic, physical or another) internal to thesystem.

SUMMARY OF THE INVENTION

One aspect of the present invention may provide an optical systemcapable of performing built-in tests of optical sensors thereof, thesystem may include: an optical sensor configured to generate a pluralityof image frames; and a processing unit in communication with the opticalsensor, the processing unit may include a built-in test model configuredto: detect, in at least one image frame of a subset of image frames ofthe plurality of images, at least one variation in one or moreparameters of the respective at least one image frame as compared to anexpected one or more parameters thereof; and determine whether the atleast one variation is due to an external optical disturbance (EOD) ofthe optical sensor or due to a failure of the optical sensor.

In some embodiments, the built-in test module is configured to: apply,on each image frame of the subset of image frames, a Fast FourierTransform (FFT) to yield an FFT image of the respective image frame;apply a high pass filter (HPF) on the FFT image of the respective imageframe to yield a HPF image of the respective image frame; sum values ofpixels of the HPF image of the respective HPF image, to yield a HPF graylevel sum value of the respective HPF image; determine whether the HPFgray level sum value of the respective HPF image is above an expectedHPF sum threshold; and indicate that the optical sensor is subjected toat least one of the EOD or the failure if the HPF gray level sum valueof the respective image frame is below the expected HPF sum thresholdvalue.

In some embodiments, the built-in test module is further configured to:detect at least one variation of the HPF gray level sum value of therespective HPF image with respect to an expected HPF gray level sumvalue thereof; identify a pattern of the at least one variation of theHPF gray level sum value with respect to the expected HPF gray level sumvalue; and determine, based on the pattern, whether the at least onevariation is due to the EOD or due to the failure of the optical sensor.

In some embodiments, the built-in test module is further configured to:calculate a histogram of each image frame of the subset of sampled imageframes to yield a histogram of the respective image frame; detect atleast one variation in the histogram of the respective image frame withrespect to an expected histogram thereof; identify a pattern of the atleast one variation of the histogram of the respective image frame withrespect to the expected histogram; and determine, based on the pattern,whether the at least one variation is due to the EOD or due to thefailure of the optical sensor.

In some embodiments, the built-in test module is further configured to:calculate a contribution of a specified object in the respective imageframe to the histogram of the respective image frame; detect at leastone variation of the contribution of the specified object to thehistogram of the respective image frame with respect to an expectedcontribution thereof; identify a pattern of the at least one variationof the contribution of the specified object to the histogram of therespective image frame with respect to an expected contribution thereof;and determine, based on the pattern, whether the at least one variationis due to the EOD or due to the failure of the optical sensor.

In some embodiments, the built-in test module is further configured to:apply a High Pass Filter (HPF) on each image frame of the sampled imageframes to yield an HPF image of the respective image frame; sum a graylevel of pixels of the respective HPF image that are above an expectedHPF gray level threshold to yield a HPF gray level sum value of therespective HPF image; detect at least one variation of the HPF graylevel sum value of the respective HPF image with respect to an expectedHPF gray level sum value thereof; identify a pattern of the at least onevariation of the HPF gray level sum value with respect to the expectedHPF gray level sum value; and determine, based on the pattern, whetherthe at least one variation is due to the EOD or due to the failure ofthe optical sensor.

In some embodiments, the system includes at least two optical sensors,and the processing unit includes a relative built-in test moduleconfigured to: receive a first image of a first subset of image framesof a first plurality of image frames generated by a first optical sensorof the at least two sensors; receive a second image a second subset ofimage frames of a second plurality of images generated by a secondoptical sensor of the at least two sensors, wherein the second imageframe corresponds to the first image frame; scale the first image frameand the second image frame to same dimensions and resolution to yield afirst scaled image and a second scaled image; apply a Fast FourierTransform (FFT) on the first scaled image to yield a first scaled FFTimage and to apply and FFT on the second scaled image to yield a secondscaled FFT image; determine a difference between the first scaled FFTimage and the second scaled FFT image; determine whether the differencebetween the first scaled FFT image and the second scaled FFT image isabove an expected difference threshold; and determine, based on thedifference and when the difference is above the expected differencethreshold, which of the first optical sensor or the second opticalsensor is subjected to the EOD or the failure.

In some embodiments, the system is disposable on a locomotive of a trainsuch that the optical sensor faces direction of travel of the train 90,and the processing unit further includes an obstacle detection moduleconfigured to analyze at least some of the plurality of image frames andto detect and identify, in the analyzed image frames, rails and apotential obstacle on the rails or in a defined vicinity of the rails.

Another aspect of the present invention provides a method of performingbuilt-in tests of optical sensors of an optical system, the method mayinclude: receiving a plurality of image frames from an optical sensor;and detecting, in at least one image frame of a subset of image framesof the plurality of images, at least one variation in one or moreparameters of the respective at least one image frame as compared to anexpected one or more parameters thereof; and determining whether the atleast one variation is due to an external optical disturbance (EOD) ofthe optical sensor or due to a failure of the optical sensor.

In some embodiments, the method further includes: applying, on eachimage frame of the subset of image frames, a Fast Fourier Transform(FFT) to yield an FFT image of the respective image frame; applying ahigh pass filter (HPF) on the FFT image of the respective image frame toyield a HPF image of the respective FFT image; summing values of pixelsof the HPF image of the respective HPF image, to yield a HPF gray levelsum value of the respective HPF image; determining whether the HPF graylevel sum value of the respective HPF image is above an expected HPF sumthreshold; and indicating that the optical sensor is subjected to atleast one of the EOD or the failure if the HPF gray level sum value ofthe respective image frame is below the expected HPF sum thresholdvalue.

In some embodiments, the method further includes: detecting at least onevariation of the HPF gray level sum value of the respective HPF imagewith respect to an expected HPF gray level sum value thereof;identifying a pattern of the at least one variation of the HPF graylevel sum value with respect to the expected HPF gray level sum value;and determining, based on the pattern, whether the at least onevariation is due to the EOD or due to the failure of the optical sensor.

In some embodiments, the method further includes: calculating ahistogram of each image frame of the subset of sampled image frames toyield a histogram of the respective image frame; detecting at least onevariation in the histogram of the respective image frame with respect toan expected histogram thereof; identifying a pattern of the at least onevariation of the histogram of the respective image frame with respect tothe expected histogram; and determining, based on the pattern, whetherthe at least one variation is due to the EOD or due to the failure ofthe optical sensor.

In some embodiments, the method further includes: calculating acontribution of a specified object in the respective image frame to thehistogram of the respective image frame; detecting at least onevariation of the contribution of the specified object to the histogramof the respective image frame with respect to an expected contributionthereof; identifying a pattern of the at least one variation of thecontribution of the specified object to the histogram of the respectiveimage frame with respect to an expected contribution thereof; anddetermining, based on the pattern, whether the at least one variation isdue to the EOD or due to the failure of the optical sensor.

In some embodiments, the method further includes: applying a High PassFilter on each image frame of the sampled image frames to yield a HPFimage of the respective image frame; summing a gray level of pixels ofthe respective HPF image that are above an expected HPF gray levelthreshold to yield a HPF gray level sum value of the respective HPFimage; detecting at least one variation of the HPF gray level sum valueof the respective HPF image with respect to an expected HPF gray levelsum value thereof; identifying a pattern of the at least one variationof the HPF gray level sum value with respect to the expected HPF graylevel sum value; and determining, based on the pattern, whether the atleast one variation is due to the EOD or due to the failure of theoptical sensor.

In some embodiments, the method further includes: receiving a firstimage of a first subset of image frames of a first plurality of imageframes generated by a first optical sensor of at least two sensors;receiving a second image a second subset of image frames of a secondplurality of images generated by a second optical sensor of the at leasttwo sensors, wherein the second image frame corresponds to the firstimage frame; scaling the first image frame and the second image frame tosame dimensions and resolution to yield a first scaled image and asecond scaled image; applying a Fast Fourier Transform (FFT) on thefirst scaled image to yield a first scaled FFT image and to apply andFFT on the second scaled image to yield a second scaled FFT image;determining a difference between the first scaled FFT image and thesecond scaled FFT image; determining whether the difference between thefirst scaled FFT image and the second scaled FFT image is above anexpected difference threshold; and determining, based on the differenceand when the difference is above the expected difference threshold,which of the first optical sensor or the second optical sensor issubjected to the EOD or the failure.

In some embodiments, the method further includes: deposing the opticalsensor on a locomotive of a train such that the optical sensor faces adirection of travel of the train; analyzing at least some of theplurality of image frames; and detecting and identifying, in theanalyzed image frames, rails and a potential obstacle on the rails or ina defined vicinity of the rails.

These, additional, and/or other aspects and/or advantages of the presentinvention are set forth in the detailed description which follows;possibly inferable from the detailed description; and/or learnable bypractice of the present invention.

BRIEF DESCRIPTION OF THE DRAWINGS

For a better understanding of embodiments of the invention and to showhow the same can be carried into effect, reference will now be made,purely by way of example, to the accompanying drawings in which likenumerals designate corresponding elements or sections throughout.

In the accompanying drawings:

FIG. 1A is a schematic illustration of an optical system capable ofperforming an optical built-in test of an optical sensor thereof,according to some embodiments of the invention;

FIG. 1B is a schematic illustration of an optical system includingmultiple optical sensors and capable of performing a built-in test and arelative built-in test of optical sensors thereof, according to someembodiments of the invention;

FIG. 1C is a flowchart of a method of performing a built-in test of anoptical sensor of an optical system, according to some embodiments ofthe invention;

FIG. 1D is a flowchart of a method of performing a relative built-intest of between two optical sensors of an optical system, according tosome embodiments of the invention;

FIG. 2 is a schematic illustration of an optical system for an obstacledetection by a moving train and capable of performing a built-in testand a relative built-in test of optical sensors thereof, according tosome embodiments of the invention;

FIG. 3 is a set of image frames taken by an optical system including atleast two optical sensors (in which a relative built in test is appliedto one subset of the image frames in comparison to a second subset ofthe image frames, according to embodiments of the invention;

FIG. 4 is a set of image frames presenting an input image frame, theinput image frame after applying a threshold filter and after applying anoise filter, according to embodiments of the invention;

FIG. 5 is a set of frames including an image frame taken with clean lensof an optical sensor of an optical system and an image frame taken witha non-clean lens of the optical sensor of the optical system and a frameresulting from subtraction of the frames images thereof, according toembodiments of the invention;

FIG. 6 is a set of image frames showing images taken by an opticalsensor of an optical system on which a FFT operator was effected, andderivatives of these frames on which subtraction, threshold and noisereduction have been operated, according to embodiments of the invention;and

FIG. 7 is a flowchart of a method of performing built-in tests ofoptical sensors of an optical system, according to some embodiments ofthe invention.

It will be appreciated that, for simplicity and clarity of illustration,elements shown in the figures have not necessarily been drawn to scale.For example, the dimensions of some of the elements may be exaggeratedrelative to other elements for clarity. Further, where consideredappropriate, reference numerals may be repeated among the figures toindicate corresponding or analogous elements.

DETAILED DESCRIPTION OF THE INVENTION

In the following description, various aspects of the present inventionare described. For purposes of explanation, specific configurations anddetails are set forth in order to provide a thorough understanding ofthe present invention. However, it will also be apparent to one skilledin the art that the present invention can be practiced without thespecific details presented herein. Furthermore, well known features canhave been omitted or simplified in order not to obscure the presentinvention. With specific reference to the drawings, it is stressed thatthe particulars shown are by way of example and for purposes ofillustrative discussion of the present invention only and are presentedin the cause of providing what is believed to be the most useful andreadily understood description of the principles and conceptual aspectsof the invention. In this regard, no attempt is made to show structuraldetails of the invention in more detail than is necessary for afundamental understanding of the invention, the description taken withthe drawings making apparent to those skilled in the art how the severalforms of the invention can be embodied in practice.

Before at least one embodiment of the invention is explained in detail,it is to be understood that the invention is not limited in itsapplication to the details of construction and the arrangement of thecomponents set forth in the following description or illustrated in thedrawings. The invention is applicable to other embodiments that can bepracticed or carried out in various ways as well as to combinations ofthe disclosed embodiments. Also, it is to be understood that thephraseology and terminology employed herein is for the purpose ofdescription and should not be regarded as limiting.

Unless specifically stated otherwise, as apparent from the followingdiscussions, it is appreciated that throughout the specificationdiscussions utilizing terms such as “processing”, “computing”,“calculating”, “determining”, “enhancing” or the like, refer to theaction and/or processes of a computer or computing system, or similarelectronic computing device, that manipulates and/or transforms datarepresented as physical, such as electronic, quantities within thecomputing system's registers and/or memories into other data similarlyrepresented as physical quantities within the computing system'smemories, registers or other such information storage, transmission ordisplay devices. Any of the disclosed modules or units can be at leastpartially implemented by a computer processor.

Generally, an optical system including one or more optical sensors and aprocessing unit capable of performing built-in tests of the opticalsensor(s) and methods thereof are disclosed.

According to some embodiments, the processing unit includes a built-intest module. The built-in test module may be configured to detect areduction of an optical quality of at least some of the images generatedby the optical sensors with respect to an expected optical qualitythereof. In various embodiments, the built-in test module is furtherconfigured to determine whether the reduction of the optical qualitythereof is due to the “external optical disturbances” (EOD) and/orfailure of the optical sensor(s)/system.

According to some embodiments, the processing unit includes a relativebuilt-in test module. The relative built-in test module may beconfigured to compare at least some images generated by at least two ofthe optical sensors and to determine the reduction of optical quality ofimage frames generated by one optical sensor of the at least two opticalsensors with respect to another optical sensor of the at least twooptical sensors. The reduction of the optical quality may be due to, forexample, the EOD and/or failure.

One advantage of the present invention is that implementation of themethods performed by the built-in test module and/or the relativebuilt-in test module may be low consumer of computational resourcesrequired to perform the methods. Another advantage of the presentinvention is that implementation of the methods performed by thebuilt-in test module and/or the relative built-in test module eliminatea need in any predetermined reference data/image frames.

Accordingly, the implementation of the methods thereof may be performedin real time (e.g., without any latency to the stream of the imageframes) and virtually without disturbing an operational functionality ofthe optical system/processing unit, while providing high failurecoverage probability. Furthermore, the methods thereof do not requiresaving/storing of the image frames to perform the methods and thus mayreduce the overall storage space of the optical system by about 6 Mb pereach image frame that needs not to be saved, compared to methods thatrequire saving of the frames for further processing.

Reference is now made to FIG. 1A, which is a schematic illustration ofan optical system 100 capable of performing an optical built-in test ofan optical sensor 110 thereof, according to some embodiments of theinvention.

According to some embodiments, system 100 includes an optical sensor 110and a processing unit 120 (e.g., as shown in FIG. 1A). Processing unit120 may be in communication (wired or wireless) with optical sensor 110.Optical sensor 110 may be, for example, still or video camera.

Optical sensor 110 may be configured to generate a plurality of imageframes 112 of the scenes in its field of view (FOV). Processing unit 120may be configured to receive plurality of image frames 112 from opticalsensor 110.

According to some embodiments, processing unit 120 includes a built-intest module 130. Built-in test module 130 may be configured to perform abuilt-in test of optical sensor 110 based on at least some of the imageframes generated by optical sensor 110.

Processing unit 120 may be configured to periodically sample imageframes of plurality of image frames 112 according to a desired testfrequency and according to a framerate of optical sensor 110 to yield asubset of sampled image frames (SIF) 114 and to input subset of sampledimage frames 114 to built-in test module 130.

Built-in test module 130 may be configured to detect a reduction of anoptical quality of at least one image frame of subset of sampled imageframes 114 as compared to an expected optical quality thereof. Thereduction of the optical quality of the image frame(s) may be determinedbased on a reduction/degradation of high spatial frequency energy of therespective image frame(s) as compared to an expected high spatialfrequency energy thereof. The detection of the reduction/degradation ofthe of high spatial frequency energy of the image frame(s) may becarried out by, for example, applying, on the respective image frame(s),any transformation to a frequency domain (e.g., a Fast Fourier Transform(FFT), as described below with respect to FIG. 1C).

In some embodiments, built-in test module 130 is configured to determinewhether the detected reduction of the optical quality of the at leastone image frame is due to an external optical disturbance (EOD) ofoptical sensor 110 or due to a failure (e.g., optical, electronic,physical or the like) of optical sensor 110.

According to various embodiments, built-in test module 130 is configuredto detect the reduction of the optical quality of the at least one imageframe based on at least one variation in one or more parameters of therespective at least one image frame as compared to an expected one ormore parameters thereof. In some embodiments, built-in test module 130is configured to determine whether the variation(s) thereof is due tothe EOD of optical sensor 110 or due to the failure of optical sensor110 (e.g., as described below with respect to FIG. 1C).

According to some embodiments, processing unit 120 includes a repository122 of image frames. Processing unit 120 may be configured to store, inrepository 122, at least some of plurality of image frames 112 generatedby optical sensor 110.

In some embodiments, repository 122 is in communication with built-inmodule 130. In some embodiments, repository 122 includes a DDR drive.

Reference is now made to FIG. 1B, which is a schematic illustration ofan optical system 100 including multiple optical sensors 110 and capableof performing a built-in test and a relative built-in test of opticalsensors 110 thereof, according to some embodiments of the invention.

According to some embodiments, system 100 includes multiple opticalsensors 110 (e.g., as shown in FIG. 1B). For example, system 100 mayinclude K optical sensors 110(1) to 110(K) (e.g., as shown in FIG. 1B).Each of multiple optical sensors 110(1) to 110(K) may be configured togenerate a respective plurality of image frames, to yield multiplepluralities of image frames 112(1) to 112(K) (e.g., as shown in FIG.1B).

Processing unit 120 may be configured to sample image frames frompluralities of image frames 112(1) to 112(K) to yield correspondingsubsets of sampled image frames 114(1) to 114(K) (e.g., as describedabove with respect to FIG. 1A).

Built-in test module 130 of processing unit 120 may be configured toperform the built-in test of at least one optical sensor (or of eachoptical sensor) of optical sensors 110(1) to 110(K) to thereby detectand/or determine whether the reduction of the optical quality of theimage frame(s) generated by the respective optical sensor is due to theEOD and/or due to the failure of the respective optical sensor (e.g., asdescribed above with respect to FIG. 1A and as described below withrespect to FIG. 1C).

In various embodiments, built-in test module 130 is configured toperform the build-in test of one optical sensor of optical sensors110(1) to 110(K) each at a different time or to perform the build-intest of two or more optical sensors of optical sensors 110(1) to 110(K)in parallel. In some embodiments, system 100 includes two or morebuilt-in test modules 130 configured to perform parallel built-intesting of corresponding two or more optical sensors of optical sensors110(1) to 110(K).

According to some embodiments, system 100 includes a relative built-intest module 140. Relative built-in test module 140 may be configured tocompare image frames of at least two subsets of sampled images 114(1) to114(2) of corresponding at least two of optical sensor(s) 110(1) to110(K). Relative built-in test module 140 may be configured to detectand indicate, based on the comparison thereof, which of the at least twoof optical sensors 110(1) to 110(K), if any, generates image frames withreduced optical quality with respect to each other, due to, for example,the EOD and/or the failure (e.g., as described below with respect toFIG. 1D).

In some embodiments, relative built-in test module may be incommunication with repository 122 of image frames.

It is noted that the description below (e.g., made with respect to FIGS.1C and 1D, FIG. 3, FIG. 4, FIG. 6 and FIG. 7) provides a Fast FourierTransform (FFT) as an example of transformation of the image frames intoa frequency domain. It should be understood that other transformationsto the frequency domain may be used as well.

Reference is now made to FIG. 1C, which is a flowchart of a method ofperforming a built-in test of an optical sensor 110 of an optical system100, according to some embodiments of the invention.

It is noted that the method is not limited to the flowcharts illustratedin FIG. 1C and to the corresponding description. For example, in variousembodiments, the method needs not pass through each illustrated box orstage, or in exactly the same order as illustrated and described.

According to some embodiments, processing unit 120 is configured toreceive a plurality of image frames from an optical sensor (stage120-1). For example, plurality of image frames 112 and optical sensor110 described above with respect to FIG. 1A.

It is noted that FIG. 1C shows the method of performing the built-intest of a single optical sensor for sake of clarity and that the methodthereof may be applied on each of the optical sensors of the opticalsystem.

According to some embodiments, processing unit 120 is configured toperiodically sample image frames of the plurality of image framesaccording to the desired test frequency and according to the framerateof the optical sensor (stage 120-2) to yield a subset of sampled imageframes. For example, subset of sampled image frames 114 as describedabove with respect to FIGS. 1A and 1B.

Build-in test module 130 may be configured to apply the build-in testbased on each image frame of the subset of sampled image frames.

According to some embodiments, built-in test module 130 is configured toapply, on each image frame of the subset of sampled image frames, a FastFourier Transform (FFT) to yield an FFT image of the respective imageframe (stage 130-1). The FFT image may, for example, represent atwo-dimensional (2D) spatial frequency domain of the respective imageframe.

In some embodiments, built-in test module 130 is configured to apply ahigh pass filter (HPF) on the FFT image of the respective image frame toyield a HPF image of the respective FFT image (stage 130-2).

In some embodiments, built-in test module 130 is configured to sumenergy/gray level of pixels of the respective HPF image, to yield a HPFgray level sum value of the respective HPF image (stage 130-3). In someembodiments, stages 130-3 to 130-6 are performed with respect to thenumber of pixels of the respective HPF image (e.g., rather than withrespect to the HPF gray level sum value thereof).

In some embodiments, built-in test module 130 is configured to determinewhether the HPF gray level sum value of the respective HPF image isabove an expected HPF gray level sum threshold (stage 130-4).

The HPF gray level sum value may be indicative of, for example, the EODof the optical sensor or of the failure of the optical sensor. Forexample, the HPF gray level sum value that is below the expected HPFgray level sum threshold may indicate that the optical sensor may besubjected to the EOD or failure.

In some embodiments, when the HPF gray level sum value of the respectiveHPF image is below the expected HPF gray level sum threshold value,built-in test module 130 is configured to indicate that the opticalsensor is subjected to at least one of the EOD or the failure (stage130-5).

In other embodiments, when the HPF gray level sum value of therespective HPF image is above the expected HPF gray level sum thresholdvalue, built-in test module 130 is configured to perform the built-intest on a subsequent image frame of the sampled image frames (stage130-1).

According to some embodiments, built-in test module 130 is configured todetect at least one variation of the HPF gray level sum value of therespective HPF image with respect to an expected/predefined HPF graylevel sum value thereof (stage 130-6). It is noted that other parametersof HPF image (e.g., rather than the HPF gray level sum value) may betracked for detection variation(s) thereof.

Variation(s) of the HPF gray level sum value of the respective HPF withrespect to the expected HPF gray level sum value may be indicative of,for example, the EOD and/or of the failure of the optical sensor/system.The variation(s) may, for example, include changes in mean and/orstandard deviation of the HPF gray level sum value as compared toexpected values thereof.

For example, variation(s) in low frequencies of the HPF image and as aresult slow drifting variation(s) (e.g., within a time range of 1-3sec.) in the mean of HPF gray level sum value with respect to theexpected HPF gray level sum value may be indicate of a change in weatherconditions (e.g., EOD). In another example, rapid variations (e.g., stepfunction like variations/variation(s) within a time range of 1/30- 1/25sec.) in the HPF gray level sum value as compared to the expected HPFgray level sum value may be indicative of a physical impact/failure ofthe optical sensor.

In some embodiments, when the variation(s) in the HPF gray level sumvalue with respect to the expected HPF gray level sum value is/aredetected, built-in test module 130 is configured to indicate that theoptical sensor is subjected to at least one of the EOD or the failure(stage 130-5).

In some embodiments, built-in-test module 130 is further configured todetermine whether the variation(s) is/are due to the EOD or due to thefailure of the optical sensor/system (stage 130-7). For example,built-in test module 130 may be configured to identify a pattern of thevariation(s) of the HPF gray level sum value with respect to theexpected HPF gray level sum value (e.g., either rapid or slow driftingvariations, as described above) and to determine, based on the patternthereof, whether the variation(s) is due to the external opticaldisturbance or due to the failure of the optical sensor/system.

In other embodiments, when no variation(s) in the HPF gray level sumvalue with respect to the expected HPF gray level sum value is/aredetected, built-in test module 130 is configured to perform the built-intest on a subsequent image frame of the sampled image frames (stage130-1).

According to some embodiments, built-in test module 130 is configured tocalculate a histogram of each image frame of the subset of sampled imageframes to yield a histogram (HIST) of the respective image frame (stage130-8).

In some embodiments, built-in test module 130 is configured to detect acontribution of a specified object in the respective image frame to thehistogram of the respective image frame (stage 130-9). For example, inthe case when the optical system is a system for detection of obstaclesby a moving train, the specified object may be a rail track (e.g., asdescribed below with respect to FIG. 2).

In various embodiments, built-in test module 130 is configured to detectat least one variation in the histogram of the respective image framewith respect to an expected histogram thereof and/or at least onevariation in the contribution of the specified object to the histogramof the respective image frame with respect to an expected contributionthereof (stage 130-9). The variation(s) thereof may, for example,include changes in mean and/or standard deviation of the histogram orthe contribution to the histogram of the respective image as compared tothe expected values thereof.

The variation(s) of the histogram of the respective image with respectto the expected histogram thereof and/or the variation(s) of thecontribution of the specified object to the histogram with respect tothe expected contribution may be indicative of, for example, the EODand/or of the failure of the optical sensor/system. For example, rapidvariation(s) may be indicative of a physical damage/block (e.g.,failure) of the optical sensor. In another example, small driftingvariation(s) may be indicative of changing weather conditions (e.g.,EOD).

In various embodiments, when variation(s) in the histogram of therespective image frame with respect to the expected histogram and/or thevariation(s) of the contribution with respect to the expectedcontribution to the histogram of the respective image frame aredetected, built-in test module 130 is configured to indicate that theoptical sensor is subjected to at least one of the EOD or the failure(stage 130-5).

In some embodiments, built-in test module 130 is further configured todetermine whether the variation(s) is/are due to the EOD or due to thefailure of the optical sensor/system (stage 130-7). For example,built-in test module 130 may be configured to identify a pattern of thevariation(s) of the histogram of the respective image frame with respectto the expected histogram or a pattern of the variation(s) of thecontribution of the specified object to the histogram of the respectiveimage frame (e.g., either rapid of slow drifting variation(s) asdescribed above) and to determine, based on the pattern(s) thereof,whether the variation(s) is due to the EOD or due to the failure of theoptical sensor/system.

In other embodiments, when no variation(s) the histogram of therespective image frame with respect to the expected histogram and/or novariation(s) of the contribution of the specified object to thehistogram of the respective image frame are detected, built-in testmodule 130 is configured to perform the built-in test on a subsequentimage frame of the sampled image frames (stage 130-1).

According to some embodiments, built-in test module 130 is configured toapply a Difference of Boxes/Blobs (DOB) filter (or any High Pass Filter(HPF) filter) on each image frame of the sampled image frames to yield aDOB/HPF image of the respective image frame (stage 130-11).

In some embodiments, built-in test module 130 is configured to sum anenergy/gray level of pixels of the DOB/HPF image of the respective imageframe that are above an expected DOB/HPF threshold to yield a DOB/HPFgray level sum value of the respective DOB/HPF image (stage 130-12). Insome embodiments, stages 130-12 to 130-13 are performed with respect tothe number of pixels of the respective DOB/HPF image (e.g., rather thanwith respect to the DOB/HPF gray level sum value thereof).

In some embodiments, built-in test module 130 is configured to detect atleast one variation of the DOB/HPF gray level sum value of therespective DOB/HPF image with respect to an expected DOB/HPF gray levelsum value thereof (stage 130-13).

Variation(s) of the DOB/HPF gray level sum value of the respectiveDOB/HPF image with respect to the expected DOB/HPF gray level sum valuemay be indicative of, for example, the EOD and/or of the failure of theoptical sensor/system. The variation(s) may, for example, includechanges in mean and/or standard deviation of the DOB/HPF gray level sumvalue as compared to expected values thereof. For example, rapidvariation(s) in the DOB/HPF gray level sum value may be indicate of thefailure of the optical sensor. In another example, slow driftingvariation(s) may be indicative of the EOD.

In some embodiments, when the variation(s) in the DOB/HPF gray level sumvalue with respect to the expected DOB/HPF gray level sum value is/aredetected, built-in test module 130 is configured to indicate that theoptical sensor is subjected to at least one of the EOD or the failure(stage 130-5).

In some embodiments, built-in module 130 is further configured todetermine whether the variation(s) is/are due to the EOD or due to thefailure of the optical sensor/system (stage 130-7). For example,built-in test module 130 may be configured to identify a pattern of thevariation(s) of the DOB/HPF gray level sum value with respect to theexpected DOB/HPF gray level sum value (e.g., either rapid or slowdrifting variations, as described above) and to determine, based on thepattern thereof, whether the variation(s) is due to the external opticaldisturbance or due to the failure of the optical sensor/system.

In other embodiments, when no variation(s) in the DOB/HPF gray level sumvalue with respect to the expected HPF gray level sum value is/aredetected, built-in test module 130 is configured to perform the built-intest on a subsequent image frame of the sampled image frames (stage130-1).

According to some embodiments, built-in test module 130 is configured toperform the build-in test of the optical sensor by utilizing at leastone of an FFT channel (e.g., stages 130-1 to 130-6), a HIST channel(e.g., stages 130-8 to 130-10), a DOB/HPF channel (130-11 to 130-13) ofthe build-in test or any combination thereof on the respective imageframe.

According to some embodiments, the expected parameters are determined bybuilt-in test module 130 using machine learning and/or deep learningtechniques. For example, built-in test module 130 may be configured toderive and/or to modify the expected parameters from the image framesthat are periodically sampled from the plurality of image framesgenerated by the optical sensor.

The expected parameters may, for example, include the expected HPF sumthreshold, the expected HPF gray level sum value, the expectedhistogram, the expected contribution of the specified object to thehistogram, the expected HPF/DOB threshold and/or the expected HPF/DOBgray level sum value—as described above with respect to FIG. 1C.

According to some embodiments, built-in module 130 is configured todetect, in the respective image frame, at least one variation (e.g.,vanishing) of at least one object (e.g., buildings, posts, bridges,etc.) that appears in previous image frames and determine, based on thevariation(s) thereof that the optical sensor is subjected to the EODand/or failure.

Reference is now made to FIG. 1D, which is a flowchart of a method ofperforming a relative built-in test of between two optical sensors 110of an optical system 100, according to some embodiments of theinvention.

It is noted that the method is not limited to the flowcharts illustratedin FIG. 1C and to the corresponding description. For example, in variousembodiments, the method needs not move through each illustrated box orstage, or in exactly the same order as illustrated and described.

According to some embodiments, processing unit 120 is configured toreceive a first plurality of image frames from a first optical sensorand a second plurality of image frames from a second optical sensor ofthe optical sensors of optical system 100 (stage 120-1). For example,the first optical sensor and the second optical sensor may be any ofoptical sensors 110(1) to 110(K) as described above with respect to FIG.1B.

According to some embodiments, processing unit 120 is configured toperiodically sample the first plurality of image frames to yield a firstsubset of sampled image frames and to periodically sample the secondplurality of the image frames to yield a second subset of sampled imageframes (stage 120-2) (e.g., as described above with respect to FIGS. 1A,1B and 1C).

Relative built-in test module 140 may be confuted to apply the relativebuilt-in test based on each image frame of the first subset of sampledimage frames and corresponding image frame of the second subset ofsampled image frames.

According to some embodiments, relative built-in rest module 140 isconfigured to receive a first image frame from the first subset ofsampled image frames and a second image frame of the second subset ofsampled image frames, wherein the second image frame corresponds to thefirst image frames (stage 140-1).

In various embodiments, dimensions and/or resolution of the first imageframe is different as compared to dimensions and/or resolution of thesecond image frame. In these embodiments, relative built-in test module140 is configured to scale the first image frame and the second imageframe to same dimensions and/or resolution to yield a first scaled imageand a second scaled image (stage 140-2).

In some embodiments, relative built-in test module 140 is configured toapply an FFT on the first scaled image to yield a first scaled FFT imageand to apply an FFT on the second scaled image to yield a second scaledFFT image (stage 140-3). In some embodiments, the FFT is applied on eachof the first scaled image frame and the second scaled image frames witha gain correction and normalization of the images thereof.

In some embodiments, relative built-in test module 140 is configured todetermine a difference between the first scaled FFT image and the secondscaled FFT image (state 140-4). The difference thereof may be determinedby, for example, subtracting the first scaled FFT image from the secondscaled FFT image or by subtracting the second scaled FFT image from thefirst scaled FFT image.

In some embodiments, relative built-in test module 140 is configured todetermine whether the difference between the first scaled FFT image andthe second scaled FFT image is above an expected difference threshold(stage 140-5).

In some embodiments, when the difference between the first scaled FFTimage and the second scaled FFT image is above the expected differencethreshold, relative built-in test module 140 is configured to determine,based on the difference thereof, which of the first optical sensor orthe second optical sensor is subjected to the EOD or the failure (stage140-6).

In other embodiments, when the difference between the first scaled FFTimage and the second scaled FFT image is below the expected differencethreshold, relative built-in test module 140 is configured to apply therelative built-in test on subsequent image frame of the first set ofsampled image frames and corresponding subsequent image frame of thesecond set of sampled image frames (stage 140-1).

Reference is now made to FIG. 2, which is a schematic illustration of anoptical system 200 for an obstacle detection by a moving train 90 andcapable of performing a built-in test and a relative built-in test ofoptical sensors 210 thereof, according to some embodiments of theinvention.

According to some embodiments, optical system 200 includes one or moreoptical sensors 210 and a processing unit 220 in communication withoptical sensor(s) 210. System 200 may be disposed on, for example, alocomotive 92 of train 90 such that optical sensor(s) 210 face thedirection of travel of train 90. For example, optical system 200,optical sensor(s) 210 and/or processing unit 220 may be similar tooptical system 100, optical sensor(s) 110 and/or processing unit 120,respectively, as described above with respect to FIGS. 1A, 1B, 1C and1D.

Optical sensor(s) 210 may generate images of the environment (e.g.,plurality/pluralities of image frames 112 as described above withrespect to FIGS. 1A and 1B).

According to some embodiments, processing unit 220 includes an obstacledetection and identification module 225. Obstacle detection andidentification module 225 may be configured to analyze the imagesgenerated by optical sensor(s) 210 and identify rails 80 in the imagesand/or identify a potential object/obstacle 70 on rails 80 or in adefined vicinity of rails 80.

According to some embodiments, processing unit 220 includes at least oneof: a built-in test module 230 (e.g., similar to built-in test module130 as described above with respect to FIGS. 1A, 1B and 1C) and arelative built-in test module 240 (e.g., similar to relative built-intest module 140 as described above with respect to FIGS. 1B and 1D).

Built-in test module 230 may be configured to detect the reduction ofoptical quality of the images generated by at least one of opticalsensors 210 and, in some embodiments, to determine whether the reductionof the optical quality thereof is due to the EOD and/or failure (e.g.,as described above with respect to FIGS. 1A, 1B and 1C).

Relative built-in test module 240 may be configured to compare imagesgenerated by at least two of optical sensor(s) 210 and to detect whichof the at least two optical sensors thereof, if any, is subjected to atleast one of the EOD and/or failure (e.g., as described above withrespect to FIGS. 1B and 1D).

According to some embodiments, the built-in test (e.g., performed bybuilt-in test module 230) and the relative built-in test (e.g.,performed by relative built-in test module 240) are performed inparallel.

Reference is now made to FIG. 3, which is a set of image frames taken byan optical system (such as optical system 100 or 200) including at leasttwo optical sensors (such as optical sensors 110 or 210) in which arelative built in test is applied to one subset of the image frames incomparison to a second subset of the image frames, according toembodiments of the invention.

Frame 302 is an input image Frame 304 is a blurred image of input image302. Frame 306 is the ROI image of frame 302. Frame 308 is the blurredimage of frame 304. Frame 310 is the result of filtering with FFT filterimage 302. Frame 312 is the FFT filtering result of frame 308.

Reference is now made to FIG. 4, which is a set of image framespresenting an input image frame, the input image frame after applying athreshold filter and after applying a noise filter, according toembodiments of the invention.

Frame 402 is an input image, frame 404 is the result of activating athreshold on frame 402 and frame 406 is the result of noise reductionoperation on frame 406.

Reference is now made to FIG. 5, which is a set of frames including aimage frame taken with clean lens of an optical sensor of an opticalsystem (such as optical sensors 110, 210 and optical systems 100, 200)and a image frame taken with a non-clean lens of the optical sensor ofthe optical system and a frame resulting from subtraction of the framesimages thereof, according to embodiments of the invention.

Image frame 502 depicts an image taken with clean lens of the opticalsensor. Image frame 504 depicts the image of the same scenery taken withnon-clean lens of the optical sensor and frame 506 depicts the imageresulting from applying difference operator on the image frames 502 and504.

Reference is now made to FIG. 6, which is a set of image frames showingimage frames taken by an optical sensor of an optical system (such asoptical sensors 110, 210 and optical systems 100, 200) on which a FFToperator was effected, and derivatives of these frames on whichsubtraction, threshold and noise reduction have been operated, accordingto embodiments of the invention.

Image frame 606 depicts the result of operating difference operator oninput image frame subject to FFT taken by the optical sensor of theoptical sensor with clean lens (image frame 602) and an FFT result of animage frame taken by the optical sensor with non-clean lens (image frame604). Image frame 608 depicts the result of applying a threshold on theimage of frame 606 (the resulting artifact 608 b shown encircled withcircle 608 a. Image frame 610 depicts the result of applying noisereduction on the image of frame 608. Image frame 612 depicts the resultof applying inverse FFT and noise reduction and differences on the inputshown in FIG. 4.

Reference is now made to FIG. 7, which is a flowchart of a method 700 ofperforming built-in tests of optical sensors of an optical system,according to some embodiments of the invention.

Method 700 may be implemented by optical system 100 (e.g., as describedabove with respect to FIGS. 1A, 1B, 1C and 1D) or optical system 200(e.g., as described above with respect to FIG. 2), which may beconfigured to implement method 700. It is noted that method 700 is notlimited to the flowcharts illustrated in FIG. 7 and to the correspondingdescription. For example, in various embodiments, method 700 needs notmove through each illustrated box or stage, or in exactly the same orderas illustrated and described.

According to some embodiments, method 700 includes receiving a pluralityof image frames from an optical sensor of an optical system (stage 702).For example, the optical sensor may be any one of optical sensors 110 or210 and the optical system may be any one of optical systems 100 or 200(as described above with respect to FIGS. 1A-1D and FIG. 2,respectively)

In some embodiments, method 700 includes detecting, in at least oneimage frame of a subset of image frames of the plurality of images, atleast one variation in one or more parameters of the respective at leastone image frame as compared to an expected one or more parametersthereof (stage 704). For example, the subset of image frames may besubset 114 of sampled images (e.g., as described above with react toFIGS. 1A and 1C).

In some embodiments, method 700 includes determining whether the atleast one variation is due to an external optical disturbance (EOD) ofthe optical sensor or due to a failure of the optical sensor (stage 706)(e.g., as described above with respect to FIG. 1A).

According to some embodiments, method 700 includes applying, on eachimage frame of the subset of image frames, a Fast Fourier Transform(FFT) to yield an FFT image of the respective image frame (stage 710)(e.g., as described above with respect to FIG. 1C). It is noted thatother transformations to a frequency domain (rather than FFT) may beapplied on the image frames (e.g., as described above with respect toFIG. 1C).

In some embodiments, method 700 includes applying a high pass filter(HPF) on the FFT image of the respective image frame to yield a HPFimage of the respective FFT image (stage 712) (e.g., as described abovewith respect to FIG. 1C).

In some embodiments, method 700 includes summing energy/gray level ofpixels of the HPF image of the respective HPF image, to yield an HPFgray level sum value of the respective HPF image (stage 714) (e.g., asdescribed above with respect to FIG. 1C).

In some embodiments, method 700 includes determining whether the HPFgray level sum value of the respective HPF image is above an expectedHPF gray level sum threshold (stage 716) (e.g., as described above withrespect to FIG. 1C).

In some embodiments, method 700 includes indicating that the opticalsensor is subjected to at least one of the EOD or the failure if the HPFgray level sum value of the respective HPF image is below the expectedHPF gray level sum threshold value (stage 718) (e.g., as described abovewith respect to FIG. 1C).

In some embodiments, method 700 includes detecting at least onevariation of the HPF gray level sum value of the respective HPF imagewith respect to an expected HPF gray level sum value thereof (stage 720)(e.g., as described above with respect to FIG. 1C).

In some embodiments, method 700 includes identifying a pattern of the atleast one variation of the HPF gray level sum value with respect to theexpected HPF gray level sum value (stage 722) (e.g., as described abovewith respect to FIG. 1C).

In some embodiments, method 700 includes determining, based on thepattern, whether the at least one variation is due to the EOD or due tothe failure of the optical sensor (stage 724) (e.g., as described abovewith respect to FIG. 1C).

According to some embodiments, method 700 includes calculating ahistogram of each image frame of the subset of sampled image frames toyield a histogram of the respective image frame (stage 730) (e.g., asdescribed above with respect to FIG. 1C).

In some embodiments, method 700 includes detecting at least onevariation in the histogram of the respective image frame with respect toan expected histogram thereof (stage 732) (e.g., as described above withrespect to FIG. 1C).

In some embodiments, method 700 includes identifying a pattern of the atleast one variation of the histogram of the respective image frame withrespect to the expected histogram (stage 734) (e.g., as described abovewith respect to FIG. 1C).

In some embodiments, method 700 includes determining, based on thepattern, whether the at least one variation is due to the EOD or due tothe failure of the optical sensor (stage 736) (e.g., as described abovewith respect to FIG. 1C).

In some embodiments, method 700 includes calculating a contribution of aspecified object in the respective image frame to the histogram of therespective image frame (stage 738) (e.g., as described above withrespect to FIG. 1C).

In some embodiments, method 700 includes detecting at least onevariation of the contribution of the specified object to the histogramof the respective image frame with respect to an expected contributionthereof (stage 740) (e.g., as described above with respect to FIG. 1C).

In some embodiments, method 700 includes identifying a pattern of the atleast one variation of the contribution of the specified object to thehistogram of the respective image frame with respect to an expectedcontribution thereof (stage 742) (e.g., as described above with respectto FIG. 1C).

In some embodiments, method 700 includes determining, based on thepattern, whether the at least one variation is due to the EOD or due tothe failure of the optical sensor (stage 744) (e.g., as described abovewith respect to FIG. 1C).

According to some embodiments, method 700 includes applying a Differenceof Boxes/Blobs (DOB) filter, or any other High Pass Filter (HPF), oneach image frame of the sampled image frames to yield a DOB/HPF image ofthe respective image frame (stage 750) (e.g., as described above withrespect to FIG. 1C).

In some embodiments, method 700 includes summing an energy/gray level ofpixels of the DOB/HPF image of the respective DOB/HPF image that areabove an expected DOB/HPF threshold to yield a DOB/HPF gray level sumvalue of the respective DOB/HPF image (stage 752) (e.g., as describedabove with respect to FIG. 1C).

In some embodiments, method 700 includes detecting at least onevariation of the DOB/HPF gray level sum value of the respective imageframe with respect to an expected DOB/HPF gray level sum value thereof(stage 754) (e.g., as described above with respect to FIG. 1C).

In some embodiments, method 700 includes identifying a pattern of the atleast one variation of the DOB/HPF gray level sum value with respect tothe expected DOB/HPF gray level sum value (stage 756) (e.g., asdescribed above with respect to FIG. 1D).

In some embodiments, method 700 includes determining, based on thepattern, whether the at least one variation is due to the EOD or due tothe failure of the optical sensor (stage 758) (e.g., as described abovewith respect to FIG. 1C).

According to some embodiments, method 700 includes receiving a firstimage of a first subset of image frames of a first plurality of imageframes generated by a first optical sensor of at least two sensors(stage 760) (e.g., as described above with respect to FIG. 1D).

In some embodiments, method 700 includes receiving a second image asecond subset of image frames of a second plurality of images generatedby a second optical sensor of the at least two sensors, wherein thesecond image frame corresponds to the first image frame (stage 762)(e.g., as described above with respect to FIG. 1D).

In some embodiments, method 700 includes scaling the first image frameand the second image frame to same dimensions and resolution to yield afirst scaled image and a second scaled image (stage 764) (e.g., asdescribed above with respect to FIG. 1D).

In some embodiments, method 700 includes applying a Fast FourierTransform (FFT) on the first scaled image to yield a first scaled FFTimage and to apply and FFT on the second scaled image to yield a secondscaled FFT image (stage 766) (e.g., as described above with respect toFIG. 1D).

In some embodiments, method 700 includes determining a differencebetween the first scaled FFT image and the second scaled FFT image(stage 768) (e.g., as described above with respect to FIG. 1D).

In some embodiments, method 700 includes determining whether thedifference between the first scaled FFT image and the second scaled FFTimage is above an expected difference threshold (stage 770) (e.g., asdescribed above with respect to FIG. 1D).

In some embodiments, method 700 includes determining, based on thedifference and when the difference is above the expected differencethreshold, which of the first optical sensor or the second opticalsensor is subjected to the EOD or the failure (stage 772) (e.g., asdescribed above with respect to FIG. 1D).

According to some embodiments, method 700 includes deposing the opticalsensor on a locomotive of a train such that the optical sensor faces adirection of travel of the train (stage 780) (e.g., as described abovewith respect to FIG. 2).

In some embodiments, method 700 includes analyzing at least some of theplurality of image frames (stage 782) (e.g., as described above withrespect to FIG. 2).

In some embodiments, method 700 includes detecting and identifying, inthe analyzed image frames, rails and a potential obstacle on the railsor in a defined vicinity of the rails (stage 784) (e.g., as describedabove with respect to FIG. 2).

One advantage of the present invention is that implementation of themethods performed by the built-in test module and/or the relativebuilt-in test module may be low consumer of computational resourcesrequired to perform the methods. Another advantage of the presentinvention is that implementation of the methods performed by thebuilt-in test module and/or the relative built-in test module eliminatea need in any predetermined reference data/image frames.

Accordingly, the implementation of the methods thereof may be performedin real time (e.g., without any latency to the stream of the imageframes) and virtually without disturbing an operational functionality ofthe optical system/processing unit, while providing high failurecoverage probability. Furthermore, the methods thereof do not requiresaving/storing of the image frames to perform the methods (e.g., asdescribed above with respect to FIGS. 1C, 1D and FIG. 7) and thus mayreduce the overall storage space of the optical system by about 6 Mb pereach image frame that needs not to be saved.

Aspects of the present invention are described above with reference toflowchart illustrations and/or portion diagrams of methods, apparatus(systems) and computer program products according to embodiments of theinvention. It will be understood that each portion of the flowchartillustrations and/or portion diagrams, and combinations of portions inthe flowchart illustrations and/or portion diagrams, can be implementedby computer program instructions. These computer program instructionscan be provided to a processor of a general purpose computer, specialpurpose computer, or other programmable data processing apparatus toproduce a machine, such that the instructions, which execute via theprocessor of the computer or other programmable data processingapparatus, create means for implementing the functions/acts specified inthe flowchart and/or portion diagram or portions thereof.

These computer program instructions can also be stored in a computerreadable medium that can direct a computer, other programmable dataprocessing apparatus, or other devices to function in a particularmanner, such that the instructions stored in the computer readablemedium produce an article of manufacture including instructions whichimplement the function/act specified in the flowchart and/or portiondiagram portion or portions thereof. The computer program instructionscan also be loaded onto a computer, other programmable data processingapparatus, or other devices to cause a series of operational steps to beperformed on the computer, other programmable apparatus or other devicesto produce a computer implemented process such that the instructionswhich execute on the computer or other programmable apparatus provideprocesses for implementing the functions/acts specified in the flowchartand/or portion diagram portion or portions thereof.

The aforementioned flowchart and diagrams illustrate the architecture,functionality, and operation of possible implementations of systems,methods and computer program products according to various embodimentsof the present invention. In this regard, each portion in the flowchartor portion diagrams can represent a module, segment, or portion of code,which includes one or more executable instructions for implementing thespecified logical function(s). It should also be noted that, in somealternative implementations, the functions noted in the portion canoccur out of the order noted in the figures. For example, two portionsshown in succession can, in fact, be executed substantiallyconcurrently, or the portions can sometimes be executed in the reverseorder, depending upon the functionality involved. It will also be notedthat each portion of the portion diagrams and/or flowchart illustration,and combinations of portions in the portion diagrams and/or flowchartillustration, can be implemented by special purpose hardware-basedsystems that perform the specified functions or acts, or combinations ofspecial purpose hardware and computer instructions.

In the above description, an embodiment is an example or implementationof the invention. The various appearances of “one embodiment”, “anembodiment”, “certain embodiments” or “some embodiments” do notnecessarily all refer to the same embodiments. Although various featuresof the invention can be described in the context of a single embodiment,the features can also be provided separately or in any suitablecombination. Conversely, although the invention can be described hereinin the context of separate embodiments for clarity, the invention canalso be implemented in a single embodiment. Certain embodiments of theinvention can include features from different embodiments disclosedabove, and certain embodiments can incorporate elements from otherembodiments disclosed above. The disclosure of elements of the inventionin the context of a specific embodiment is not to be taken as limitingtheir use in the specific embodiment alone. Furthermore, it is to beunderstood that the invention can be carried out or practiced in variousways and that the invention can be implemented in certain embodimentsother than the ones outlined in the description above.

The invention is not limited to those diagrams or to the correspondingdescriptions. For example, flow need not move through each illustratedbox or state, or in exactly the same order as illustrated and described.Meanings of technical and scientific terms used herein are to becommonly understood as by one of ordinary skill in the art to which theinvention belongs, unless otherwise defined. While the invention hasbeen described with respect to a limited number of embodiments, theseshould not be construed as limitations on the scope of the invention,but rather as exemplifications of some of the preferred embodiments.Other possible variations, modifications, and applications are alsowithin the scope of the invention. Accordingly, the scope of theinvention should not be limited by what has thus far been described, butby the appended claims and their legal equivalents.

The invention claimed is:
 1. An optical system capable of performingbuilt-in tests of optical sensors thereof, the system comprising: anoptical sensor configured to generate a plurality of image frames; and aprocessing unit in communication with the optical sensor, wherein theprocessing unit comprises: a built-in test model configured to: detect,in at least one image frame of a subset of image frames of the pluralityof images, at least one variation in one or more parameters of therespective at least one image frame as compared to an expected one ormore parameters thereof; and determine whether the at least onevariation is due to an external optical disturbance (EOD) of the opticalsensor or due to a failure of the optical sensor; apply, on each imageframe of the subset of image frames, a Fast Fourier Transform (FFT) toyield an FFT image of the respective image frame; apply a high passfilter (HPF) on the FFT image of the respective image frame to yield aHPF image of the respective image frame; sum gray level of pixels of theHPF image of the respective HPF image, to yield a HPF gray level sumvalue of the respective HPF image; determine whether the HPF gray levelsum value of the respective HPF image is above an expected HPF graylevel sum threshold; and indicate that the optical sensor is subjectedto at least one of the EOD or the failure if the HPF gray level sumvalue of the respective image frame is below the expected HPF gray levelsum threshold value.
 2. The system of claim 1, wherein the built-in testmodule is further configured to: detect at least one variation of theHPF gray level sum value of the respective HPF image with respect to anexpected HPF gray level sum value thereof; identify a pattern of the atleast one variation of the HPF gray level sum value with respect to theexpected HPF gray level sum value; and determine, based on the pattern,whether the at least one variation is due to the EOD or due to thefailure of the optical sensor.
 3. The system of claim 1 disposable on alocomotive of a train such that the optical sensor faces direction oftravel of a train, wherein the processing unit further comprises anobstacle detection module configured to analyze at least some of theplurality of image frames and to detect and identify, in the analyzedimage frames, rails and a potential obstacle on the rails or in adefined vicinity of the rails.
 4. An optical system capable ofperforming built-in tests of optical sensors thereof, the systemcomprising: an optical sensor configured to generate a plurality ofimage frames; and a processing unit in communication with the opticalsensor, the processing unit comprising: a built-in test model configuredto: detect, in at least one image frame of a subset of image frames ofthe plurality of images, at least one variation in one or moreparameters of the respective at least one image frame as compared to anexpected one or more parameters thereof; and determine whether the atleast one variation is due to an external optical disturbance (EOD) ofthe optical sensor or due to a failure of the optical sensor; calculatea histogram of each image frame of the subset of sampled image frames toyield a histogram of the respective image frame; detect at least onevariation in the histogram of the respective image frame with respect toan expected histogram thereof; identify a pattern of the at least onevariation of the histogram of the respective image frame with respect tothe expected histogram; and determine, based on the pattern, whether theat least one variation is due to the EOD or due to the failure of theoptical sensor.
 5. The system of claim 4, wherein the built-in testmodule is further configured to: calculate a contribution of a specifiedobject in the respective image frame to the histogram of the respectiveimage frame; detect at least one variation of the contribution of thespecified object to the histogram of the respective image frame withrespect to an expected contribution thereof; identify a pattern of theat least one variation of the contribution of the specified object tothe histogram of the respective image frame with respect to an expectedcontribution thereof; and determine, based on the pattern, whether theat least one variation is due to the EOD or due to the failure of theoptical sensor.
 6. An optical system capable of performing built-intests of optical sensors thereof, the system comprising: an opticalsensor configured to generate a plurality of image frames; and aprocessing unit in communication with the optical sensor, the processingunit comprising: a built-in test model configured to: detect, in atleast one image frame of a subset of image frames of the plurality ofimages, at least one variation in one or more parameters of therespective at least one image frame as compared to an expected one ormore parameters thereof; and determine whether the at least onevariation is due to an external optical disturbance (EOD) of the opticalsensor or due to a failure of the optical sensor; apply a High PassFilter (HPF) on each image frame of the sampled image frames to yield anHPF image of the respective image frame; sum a gray level of pixels ofthe respective HPF image that are above an expected HPF gray levelthreshold to yield a HPF gray level sum value of the respective HPFimage; detect at least one variation of the HPF gray level sum value ofthe respective HPF image with respect to an expected HPF gray level sumvalue thereof; identify a pattern of the at least one variation of theHPF gray level sum value with respect to the expected HPF gray level sumvalue; and determine, based on the pattern, whether the at least onevariation is due to the EOD or due to the failure of the optical sensor.7. An optical system capable of performing built-in tests of opticalsensors thereof, the system comprising: an optical sensor configured togenerate a plurality of image frames; a processing unit in communicationwith the optical sensor, the processing unit comprising: a built-in testmodel configured to: detect, in at least one image frame of a subset ofimage frames of the plurality of images, at least one variation in oneor more parameters of the respective at least one image frame ascompared to an expected one or more parameters thereof; and determinewhether the at least one variation is due to an external opticaldisturbance (EOD) of the optical sensor or due to a failure of theoptical sensor; and at least two optical sensors, wherein the processingunit comprises a relative built-in test module configured to: receive afirst image of a first subset of image frames of a first plurality ofimage frames generated by a first optical sensor of the at least twosensors; receive a second image a second subset of image frames of asecond plurality of images generated by a second optical sensor of theat least two sensors, wherein the second image frame corresponds to thefirst image frame; scale the first image frame and the second imageframe to same dimensions and resolution to yield a first scaled imageand a second scaled image; apply a Fast Fourier Transform (FFT) on thefirst scaled image to yield a first scaled FFT image and to apply andFFT on the second scaled image to yield a second scaled FFT image;determine a difference between the first scaled FFT image and the secondscaled FFT image; determine whether the difference between the firstscaled FFT image and the second scaled FFT image is above an expecteddifference threshold; and determine, based on the difference and whenthe difference is above the expected difference threshold, which of thefirst optical sensor or the second optical sensor is subjected to theEOD or the failure.
 8. A method of performing built-in tests of opticalsensors of an optical system, the method comprising: receiving aplurality of image frames from an optical sensor; detecting, in at leastone image frame of a subset of image frames of the plurality of images,at least one variation in one or more parameters of the respective atleast one image frame as compared to an expected one or more parametersthereof; applying, on each image frame of the subset of image frames, aFast Fourier Transform (FFT) to yield an FFT image of the respectiveimage frame; applying a high pass filter (HPF) on the FFT image of therespective image frame to yield a HPF image of the respective FFT image;summing gray level of pixels of the HPF image of the respective HPFimage, to yield a HPF gray level sum value of the respective HPF image;determining whether the HPF gray level sum value of the respective HPFimage is above an expected HPF gray level sum threshold; determiningwhether the at least one variation is due to an external opticaldisturbance (EOD) of the optical sensor or due to a failure of theoptical sensor; and indicating that the optical sensor is subjected toat least one of the EOD or the failure if the HPF graylevel sum value ofmframe is below the expected HPF gray level sum threshold value.
 9. Themethod of claim 8, further comprising: detecting at least one variationof the HPF gray level sum value of the respective HPF image with respectto an expected HPF gray level sum value thereof; identifying a patternof the at least one variation of the HPF gray level sum value withrespect to the expected HPF gray level sum value; and determining, basedon the pattern, whether the at least one variation is due to the EOD ordue to the failure of the optical sensor.
 10. The method of claim 8,further comprising: deposing the optical sensor on a locomotive of atrain such that the optical sensor faces a direction of travel of thetrain; analyzing at least some of the plurality of image frames; anddetecting and identifying, in the analyzed image frames, rails and apotential obstacle on the rails or in a defined vicinity of the rails.11. A method of performing built-in tests of optical sensors of anoptical system, the method comprising: receiving a plurality of imageframes from an optical sensor; detecting, in at least one image frame ofa subset of image frames of the plurality of images, at least onevariation in one or more parameters of the respective at least one imageframe as compared to an expected one or more parameters thereof;calculating a histogram of each image frame of the subset of sampledimage frames to yield a histogram of the respective image frame;detecting at least one variation in the histogram of the respectiveimage frame with respect to an expected histogram thereof; identifying apattern of the at least one variation of the histogram of the respectiveimage frame with respect to the expected histogram; determining whetherthe at least one variation is due to an external optical disturbance(EOD) of the optical sensor or due to a failure of the optical sensor;and determining, based on the pattern, whether the at least onevariation is due to the EOD or due to the failure of the optical sensor.12. The method of claim 11, further comprising: calculating acontribution of a specified object in the respective image frame to thehistogram of the respective image frame; detecting at least onevariation of the contribution of the specified object to the histogramof the respective image frame with respect to an expected contributionthereof; identifying a pattern of the at least one variation of thecontribution of the specified object to the histogram of the respectiveimage frame with respect to an expected contribution thereof; anddetermining, based on the pattern, whether the at least one variation isdue to the EOD or due to the failure of the optical sensor.
 13. A methodof performing built-in tests of optical sensors of an optical system,the method comprising: receiving a plurality of image frames from anoptical sensor; detecting, in at least one image frame of a subset ofimage frames of the plurality of images, at least one variation in oneor more parameters of the respective at least one image frame ascompared to an expected one or more parameters thereof; applying a HighPass Filter on each image frame of the sampled image frames to yield aHPF image of the respective image frame; summing a gray level of pixelsof the respective HPF image that are above an expected HPF gray levelthreshold to yield a HPF gray level sum value of the respective HPFimage; detecting at least one variation of the HPF gray level sum valueof the respective HPF image with respect to an expected HPF gray levelsum value thereof; identifying a pattern of the at least one variationof the HPF gray level sum value with respect to the expected HPF graylevel sum value; determining whether the at least one variation is dueto an external optical disturbance (EOD) of the optical sensor or due toa failure of the optical sensor; and determining, based on the pattern,whether the at least one variation is due to the EOD or due to thefailure of the optical sensor.
 14. A method of performing built-in testsof optical sensors of an optical system, the method comprising:receiving a plurality of image frames from an optical sensor; detecting,in at least one image frame of a subset of image frames of the pluralityof images, at least one variation in one or more parameters of therespective at least one image frame as compared to an expected one ormore parameters thereof; receiving a first image of a first subset ofimage frames of a first plurality of image frames generated by a firstoptical sensor of at least two sensors; receiving a second image asecond subset of image frames of a second plurality of images generatedby a second optical sensor of the at least two sensors, wherein thesecond image frame corresponds to the first image frame; scaling thefirst image frame and the second image frame to same dimensions andresolution to yield a first scaled image and a second scaled image;applying a Fast Fourier Transform (FFT) on the first scaled image toyield a first scaled FFT image and to apply and FFT on the second scaledimage to yield a second scaled FFT image; determining a differencebetween the first scaled FFT image and the second scaled FFT image;determining whether the difference between the first scaled FFT imageand the second scaled FFT image is above an expected differencethreshold; determining whether the at least one variation is due to anexternal optical disturbance (EOD) of the optical sensor or due to afailure of the optical sensor; and determining, based on the differenceand when the difference is above the expected difference threshold,which of the first optical sensor or the second optical sensor issubjected to the EOD or the failure.